package com.brainshare.an.service.impl;

import java.util.List;

import com.brainshare.an.domain.AnMechanismSettlementInfo;
import com.brainshare.an.mapper.AnMechanismSettlementInfoMapper;
import com.brainshare.an.service.IAnMechanismSettlementInfoService;
import com.brainshare.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 机构推广用户结算信息Service业务层处理
 *
 * @author liuzheng
 * @date 2022-11-12
 */
@Service
public class AnMechanismSettlementInfoServiceImpl implements IAnMechanismSettlementInfoService {
    @Autowired
    private AnMechanismSettlementInfoMapper anMechanismSettlementInfoMapper;

    /**
     * 查询机构推广用户结算信息
     *
     * @param wechatUserId 机构推广用户结算信息主键
     * @return 机构推广用户结算信息
     */
    @Override
    public AnMechanismSettlementInfo selectAnMechanismSettlementInfoByWechatUserId(Long wechatUserId) {
        return anMechanismSettlementInfoMapper.selectAnMechanismSettlementInfoByWechatUserId(wechatUserId);
    }

    /**
     * 查询机构推广用户结算信息列表
     *
     * @param anMechanismSettlementInfo 机构推广用户结算信息
     * @return 机构推广用户结算信息
     */
    @Override
    public List<AnMechanismSettlementInfo> selectAnMechanismSettlementInfoList(AnMechanismSettlementInfo anMechanismSettlementInfo) {
        return anMechanismSettlementInfoMapper.selectAnMechanismSettlementInfoList(anMechanismSettlementInfo);
    }

    /**
     * 新增机构推广用户结算信息
     *
     * @param anMechanismSettlementInfo 机构推广用户结算信息
     * @return 结果
     */
    @Override
    public int insertAnMechanismSettlementInfo(AnMechanismSettlementInfo anMechanismSettlementInfo) {
        anMechanismSettlementInfo.setCreateTime(DateUtils.getNowDate());
        return anMechanismSettlementInfoMapper.insertAnMechanismSettlementInfo(anMechanismSettlementInfo);
    }

    /**
     * 修改机构推广用户结算信息
     *
     * @param anMechanismSettlementInfo 机构推广用户结算信息
     * @return 结果
     */
    @Override
    public int updateAnMechanismSettlementInfo(AnMechanismSettlementInfo anMechanismSettlementInfo) {
        anMechanismSettlementInfo.setUpdateTime(DateUtils.getNowDate());
        return anMechanismSettlementInfoMapper.updateAnMechanismSettlementInfo(anMechanismSettlementInfo);
    }

    @Override
    public int updateAnMechanismSettlementInfoStatus(Integer settlementStatus, Long mechanismSettlementId,String updateBy) {
        return anMechanismSettlementInfoMapper.updateAnMechanismSettlementInfoStatus(settlementStatus, mechanismSettlementId,updateBy);
    }

    /**
     * 批量删除机构推广用户结算信息
     *
     * @param wechatUserIds 需要删除的机构推广用户结算信息主键
     * @return 结果
     */
    @Override
    public int deleteAnMechanismSettlementInfoByWechatUserIds(Long[] wechatUserIds) {
        return anMechanismSettlementInfoMapper.deleteAnMechanismSettlementInfoByWechatUserIds(wechatUserIds);
    }

    /**
     * 删除机构推广用户结算信息信息
     *
     * @param wechatUserId 机构推广用户结算信息主键
     * @return 结果
     */
    @Override
    public int deleteAnMechanismSettlementInfoByWechatUserId(Long wechatUserId) {
        return anMechanismSettlementInfoMapper.deleteAnMechanismSettlementInfoByWechatUserId(wechatUserId);
    }
}
